
import { appStore } from './app'
import { typeStore } from './type'
import { tagStore } from './tag'
import { articleStore } from './article'

export const initServer = async () => {
  const { setCurrentNodeEnv } = appStore()
  const { getTypeList } = typeStore()
  const { getSideBarTagList } = tagStore()
  const { getSideBarArticleList } = articleStore()
  try {
    setCurrentNodeEnv(process.env.NODE_ENV)
    await Promise.all([
      getTypeList(null),
      getSideBarTagList({ nowPage: 1, pageSize: 10 }),
      getSideBarArticleList({
        nowPage: 1,
        pageSize: 5,
        orderName: 'updated_at',
        orderBy: 'desc'
      })
    ])
    console.log('initServer初始化完成')
  } catch (error) {
    console.log('initServer初始化错误', error)
  }
}
